<?php
// +----------------------------------------------------------------------
// | tpapi.
// +----------------------------------------------------------------------
// | FileName: Dispatch.php
// +----------------------------------------------------------------------
// | Author: King east <1207877378@qq.com>
// +----------------------------------------------------------------------

namespace ke\thinkApi\src;



use ke\thinkApi\src\attribute\Lists;

class FastAction extends Controller
{
    public function addList(Lists $params = null)
    {
        $params || $params = new Lists();
        $this->regRoute($this->name . '_list', 'get', function () use($params) {
            $this->db->where($params->getWhere());

            if ($this->count) {
                $result['count'] = $this->db->count();
            }
            $result['items'] = $this->db->limit($this->offset, $this->limit)->field($params->getField())->order($params->getOrder())->select();

            return $this->setting->response($result);
        });
    }

}
